package com.koron.device.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * @author twcao
 * @title: CsysType
 * @projectName GDH_EAM_V2
 * @description: 坐标类型
 * @date 2022/3/2811:49
 */
public enum CsysType {

    GCJ02("GCJ02", "火星坐标（高德/腾讯）"), BD09("BD09", "百度地图"), GPS("WGS84", "GPS");

    String key;

    String value;

    CsysType(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public String getKey(){
        return this.key;
    }


    public static CsysType key(String key) {
        if(StringUtils.isBlank(key)) {
            return null;
        }
        switch (key) {
            case "GCJ02":
                return GCJ02;
            case "BD09":
                return BD09;
            case "WGS84":
                return GPS;
            default:
                return GPS;
        }
    }

    public static CsysType keyStr(String value) {
        if(StringUtils.isBlank(value)) {
            return null;
        }
        switch (value) {
            case "火星坐标（高德/腾讯）":
                return GCJ02;
            case "百度地图":
                return BD09;
            case "GPS":
                return GPS;
            default:
                return null;
        }
    }
}
